package com.lxd.api.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author Dongdong
 * @注释
 */

@FeignClient(value = "beacon-cache")
public interface cacheClient {

    @GetMapping("/cache/hgetall/{key}")
    Map hGetAll(@PathVariable(value = "key") String key);

    @GetMapping("/cache/hget/{key}/{field}")
    Object hget(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);

    //方法重载，修改方法名和返回类型。参数 url 都不变
    @GetMapping("/cache/hget/{key}/{field}")
    String hgetString(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);

    @GetMapping("/cache/smembers/{key}")
    Set smembers(@PathVariable(value = "key") String key);

    @GetMapping("/cache/get/{key}")
    Object get(@PathVariable(value = "key") String key);
    @GetMapping("/cache/get/{key}")
    String getString(@PathVariable(value = "key") String key);
    @PostMapping(value = "/cache/set/{key}")
     void set(@PathVariable(value = "key") String key, @RequestParam(value = "value") Object value);
}
